import styles from './index.module.scss'
const genderList = [
  { text: '男', value: '0' },
  { text: '女', value: '1' },
]

const photoList = [
  { text: '拍照', value: '' },
  { text: '本地选择', value: '' },
]

type Props = {
  type: string
  onClose: () => void
  update: (value: string | number, type: string) => void
}
const EditList = ({ type, update, onClose }: Props) => {
  const list = type === 'gender' ? genderList : photoList
  const close = () => {
    onClose()
  }
  const change = async (id: number | string) => {
    await update(id, type)

    onClose()
  }
  return (
    <div className={styles.root}>
      {/* <div className="list-item" onClick={() => change(0)}>
        男
      </div>
      <div className="list-item" onClick={() => change(1)}>
        女
      </div>

      <div onClick={close} className="list-item">
        取消
      </div> */}
      {list.map((item) => (
        <div className="list-item" onClick={() => change(item.value)}>
          {item.text}
        </div>
      ))}
      <div onClick={close} className="list-item">
        取消
      </div>
    </div>
  )
}

export default EditList
